package com.valkyries.jhhj.utils;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

/**
 * 验证码校验工具类
 */
@Component
public class CaptchaValidator {

    /**
     * 校验验证码是否有效
     */
    public boolean validate(HttpServletRequest request, String userInputCaptcha) {
        String captchaText = (String) request.getSession().getAttribute("captchaText");
        return captchaText != null && captchaText.equalsIgnoreCase(userInputCaptcha);
    }
}
